package com.itheima.job3;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;

public class Test {
    public static void main(String[] args) {
        Map<Integer,String> map = new HashMap<>();
        map.put(1,"张三");
        map.put(2,"李四");
        map.put(3,"王五");
        System.out.println("集合大小："+map.size());
        //键找值
        Set<Integer> integers = map.keySet();
        integers.forEach(key-> System.out.println(key+" "+map.get(key)));
        //键值对
        Set<Map.Entry<Integer, String>> entries = map.entrySet();
        entries.forEach(ob-> System.out.println(ob.getKey()+" "+ob.getValue()));
        System.out.println(map.get(1));
        System.out.println(map.get(10));
        System.out.println(map.containsKey(10));
        map.remove(1);
        System.out.println(map);
    }

}
